home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / std / c / 72 < prev    next >
Encoding:
Internet Message Format  |  1996-08-06  |  817 b 

  1. Path: kate.ibmpcug.co.uk!rcp!alan
  2. From: alan@rcp.co.uk (Alan Stokes)
  3. Newsgroups: comp.std.c
  4. Subject: Re: int's and zero
  5. Message-ID: <BR-8wAWLBh107h@rcp.co.uk>
  6. Date: Wed, 10 Jan 96 12:15:45 GMT
  7. References: <4cth4e$4q@odin.funcom.no> <4ctkfa$1fj0@info4.rus.uni-stuttgart.de>
  8. Organization: RCP Consultants Ltd.
  9.  
  10. In <4ctkfa$1fj0@info4.rus.uni-stuttgart.de> schweikh@itosun.ito.uni-stuttgart.de (Jens Schweikhardt) writes:
  11. >In article <4cth4e$4q@odin.funcom.no>,
  12.  
  13. >there is an (elegant, IMHO) way to initialize structures
  14. >as if you had written <member> = 0 for any member.
  15.  
  16. Yes, there is, but it's not the way you suggest. How about:
  17.  
  18. void
  19. foo (void)
  20. {
  21.     struct intstruct { ... } bar = { 0 };
  22.          /* Much more readable than memset(&bar, 0, sizeof bar); */
  23. }
  24.  
  25. -- 
  26. Alan Stokes (alan@rcp.co.uk)
  27. RCP Consultants Ltd
  28. Didcot, UK
  29.